<!doctype html>

<!--注意：引入thymeleaf的名称空间-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title th:text="${title}">Document</title>
</head>
<body>
<p th:text="'hello SpringBoot'">hello thymeleaf</p>
<!--操作域对象-->
<p th:text="${username}"></p>

<!--遍历数组-->
<table th:each="item, sta:${lists}">
    <tr>
        <td th:text="${item}"></td>
        <td th:text="${sta.index}"></td>
        <td th:text="${sta.odd}"></td>
        <td th:text="${sta.size}"></td>
    </tr>
</table>

<!--遍历map-->
<div th:each="item:${maps}" th:text="${item.key}"></div>

<!--遍历数组-->
<div th:each="item:${lists}" th:text="${item}"></div>

<!--设置属性-->
<input type="text" th:attr="value=${person2.getLastName()}">

<!--表单数据绑定-->
<form action="" th:object="${person2}">
    <input type="text" th:value="*{getLastName()}">
    <input type="password" th:value="*{getAge()}">
    <select>
        <option th:each="item:${lists}" th:text="${item}" th:selected="'a' eq ${item}"></option>
    </select>
</form>

<!--流程控制-->
<p th:if="${person2.getLastName()} != ${person2.getAge()}">yes</p>
<div th:switch="${person2.getLastName()}">
    <p th:case="rose">name is rose</p>
    <p th:case="jack">name is jack</p>
    <p th:case="李四">name is 李四</p>
</div>

</body>
</html>